<?php
use think\Facade\Route;
use think\Facade\Env;

Route::post('language', 'base/language');
Route::post('checkuser', 'base/checkUserInfo');

Route::domain(Env::get('app.api_url'), function () {

    Route::group('/', function () {
        Route::get('/', function (){
            die('api接口');
        });
    })->prefix('index/');

    Route::group('share', function () {
        Route::rule('test', 'share/test');
        Route::rule('uporder', 'share/uporder');
        Route::rule('users', 'share/users');
        Route::rule('auth', 'share/auth');
        Route::rule('pay', 'share/pay');
        Route::rule('order_detailed', 'share/order_detailed');
        Route::rule('notify', 'share/notify');
    });

    // oss
    Route::group('space', function () {
        Route::get('oss', 'space/oss');
    })->prefix('index/');
    // index
    Route::group('index', function () {
        Route::post('trend', 'index/trend');
        Route::post('banner', 'index/banner');
        Route::post('notice', 'index/notice');
        Route::post('version', 'index/version');
        Route::post('invite', 'index/invite');
        Route::post('config', 'index/config');
        Route::post('type', 'index/type');
        Route::post('quotation', 'index/quotation');
        Route::post('noticeRandom', 'index/noticeRandom');
        Route::post('team', 'index/team');
        Route::post('updateVersion', 'index/updateVersion');
        Route::post('getTransferFee', 'index/getTransferFee');
    })->prefix('index/');
    // Login
    Route::group('login', function () {
        Route::post('dologin', 'login/dologin'); //qps!
        Route::post('register', 'login/register');
        Route::post('registerByAccount', 'login/registerByAccount');
        Route::post('logout', 'login/logout');
        Route::post('sendSms', 'base/sendSms');
        Route::post('forgot', 'login/forgot');
        Route::post('device', 'login/device');
        Route::post('checkcode', 'base/checkcode');
    })->prefix('index/');
// Login
    Route::group('acticle', function () {
        Route::post('list', 'acticle/list'); //qps!
        Route::post('detail', 'acticle/detail');
        Route::post('listOther', 'acticle/list'); //qps!
        Route::post('detailOther', 'acticle/detailOther');
        Route::post('workPost', 'acticle/workPost');
        Route::post('workList', 'acticle/workList');
        Route::post('workDetail', 'acticle/workDetail');
    })->prefix('index/');
    // Invest
    Route::group('card', function () {
        Route::post('sendSms', 'card/sendSms')->middleware('Qps');
        Route::post('goods', 'card/goods');
        Route::post('checkCard', 'card/checkCard');
        Route::post('goodids', 'card/goodids');
        Route::post('goodDetail', 'card/goodDetail');
        Route::post('apiPost', 'card/apiPost');
        Route::post('picCode', 'card/picCode');
    })->prefix('index/');

//    // Level
//    Route::group('level', function () {
//        Route::post('agent', 'level/agent')->middleware('Qps');
//        Route::post('levelLog', 'level/levelLog');
//        Route::post('config', 'level/config');
//    })->prefix('index/');

    // Level
    Route::group('config', function () {
        Route::post('getConfig', 'config/getConfig');
        Route::post('getArea', 'config/getArea');
        Route::post('getLevels', 'config/getLevels');

    })->prefix('index/');

    Route::group('upload', function () {
        Route::post('uploadFile', 'upload/uploadFile');
        Route::post('uploadFileByToken', 'upload/uploadFileByToken');
    })->prefix('index/')->middleware('Qps');

    Route::group('shop', function () {
        Route::post('setstatus', 'shop/setstatus');
        Route::post('order_list', 'shop/order_list');
        Route::post('shipments', 'shop/shipments');
        Route::post('del_order', 'shop/del_order');
        Route::post('lists', 'shop/lists');
        Route::post('goodinfo', 'shop/goodinfo');
        Route::post('exchange', 'shop/exchange');
        Route::post('exNote', 'shop/exNote');
    })->prefix('index/')->middleware('Qps');

    Route::group('agent', function () {
        Route::post('getInfo', 'agent/getInfo');
        Route::post('shopApply', 'agent/shopApply');
        Route::post('shopApplyEdit', 'agent/shopApplyEdit');
        Route::post('shopApplyList', 'agent/shopApplyList');
        Route::post('shopApplyDetail', 'agent/shopApplyDetail');
        Route::post('shopStatistics', 'agent/shopStatistics');
        Route::post('childs', 'agent/childs');
        Route::post('distributionCardByCardNo', 'agent/distributionCardByCardNo');
        Route::post('distributionCardByNum', 'agent/distributionCardByNum');
        Route::post('mycards', 'agent/mycards');
        Route::post('industry', 'agent/industry');
        Route::post('withdrawalRecord', 'agent/withdrawalRecord');
        Route::post('withdrawal', 'agent/withdrawal');
        Route::post('bounsRecord', 'agent/bounsRecord');
        Route::post('teamInfo', 'agent/teamInfo');
        Route::post('bounsTotal', 'agent/bounsTotal');
        Route::post('editPass', 'agent/editPass');


    })->prefix('index/');


})->bind('index')->header('Access-Control-Allow-Origin', '*')
    ->header('Access-Control-Allow-Methods', 'POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH')
    ->header('Access-Control-Allow-Headers', 'token,current_version, language, Origin, X-Requested-With, Content-Type, Accept,device')
    ->allowCrossDomain();
